<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //创建一个对象的三种方式
    //1 采用字面量的方式
    var obj1 = {
      s: 1,
      w: function () {
      }
    }
    //2
    var obj2 = new Object()
    obj2.param = ''
    //3
    function Obj(s, d) {
      this.s = s
      this.d = d
    }
    var obj3 = new Obj(1, 2)
    //采用for查看对象的可枚举属性
    for (const key in obj3) {
      console.log(key)
    }
    //采用Object.keys
    var arr1 = Object.keys(obj3)
    console.log(arr1);
    //采用Object.getOwnPropertyNames包括不可枚举属性
    var arr2 = Object.getOwnPropertyNames(obj3)
    console.log(arr2);

  </script>
</body>

</html>